package com.lagou.task11.homework;
/**
 * 手机卡类
 */

import com.lagou.task10.StaticOuter;
import java.awt.print.Pageable;
public class CodePhoneCard {
    private String cardType;
    private String phoneNumber;
    private String name;
    private String password;
    private int accountBalance;
    private int callTime;
    private int internetTraffic;

    CodeCallPackage callPackage = new CodeCallPackage();
    CodeInternetPackage internetPackage = new CodeInternetPackage();
    /**
     * cardType         卡类型
     * phoneNumber      卡号
     * name             用户名
     * password         密码
     * accountBalance   账户余额
     * callTime         通话时间
     * internetTraffic  总上网流量
     */

    CodePhoneCard(){};

        //初始化手机卡
    public CodePhoneCard(String cardType, String phoneNumber, String name, String password, int accountBalance, int callTime, int internetTraffic) {
        setCardType(cardType);
        setPhoneNumber(phoneNumber);
        setName(name);
        setPassword(password);
        setAccountBalance(accountBalance);
        setCallTime(callTime);
        setInternetTraffic(internetTraffic);
    }

    public String getCardType() {
        return cardType;
    }

    public void setCardType(String cardType) {
        this.cardType = cardType;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public int getAccountBalance() {
        return accountBalance;
    }

    public void setAccountBalance(int accountBalance) {
        this.accountBalance = accountBalance;
    }

    public int getCallTime() {
        return callTime;
    }

    public void setCallTime(int callTime) {
        this.callTime = callTime;
    }

    public int getInternetTraffic() {
        return internetTraffic;
    }

    public void setInternetTraffic(int internetTraffic) {
        this.internetTraffic = internetTraffic;
    }

    //  订购上网套餐

    //1、show方法使用传多个参数方式接收对象
    //  打印账户信息
    public void show(int... args){
        System.out.println("============================手机卡信息==================================");
        for(int i = 0;i<args.length;i++){
            if(i == 0){
                setCallTime(args[i]);
            }else{
                setInternetTraffic(args[i]);
            }
        }
        showAccountBalance();
    }

        //　　2、showAccountBalance方法打印账户情况
    public void showAccountBalance(){
        //  显示账户余额
        System.out.println("==============================账户余额================================");
        System.out.println("手机卡类型:"+getCardType()+"\n卡号:"+getPhoneNumber()+"\n用户名："+getName()+"\n密码："+getPassword()+
                "\n账户余额:"+getAccountBalance()+"\n历史通话时长："+getCallTime()+"分钟\n历史流量使用情况:"+getInternetTraffic()+"GB");
    }

       // 　　3、创建通话消费方法addCall，传入到普通通话类中
    //  通话消费
    public void addCall(int a,CodePhoneCard codePhoneCard){
        callPackage.callPackage(a,codePhoneCard);
    }

        //　　4、创建流量消费方法addinternet，传入到普通上网类中
    //  流量消费
    public void addInternet(int a,CodePhoneCard codePhoneCard){
        internetPackage.internetPackage(a,codePhoneCard);
    }
}
